<template>
    <div class="hello">
        <van-nav-bar title="直播页面" :fixed="true" :placeholder="true" @click-left="$router.go(-1)" />

        <video id="videoElement" width="100%" controls></video>

        <div>当前时间：{{time}}</div>
    </div>
</template>
<script>
  import flvjs from 'flv.js/dist/flv.min.js'
  import dayjs from 'dayjs'

  export default {
    watch: {
      time: function(_v) {
        // this.time = _v;
        console.log('log bv::', _v)
      }
    },
    data() {
      return {
        time: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
      }
    },
    mounted(){
      //this.$Title('打开失败')

      if (flvjs.isSupported()) {
        var videoElement = document.getElementById('videoElement')
        var flvPlayer = flvjs.createPlayer({
/*          type: getFileSuffix(row.fileName),
          url: this.getCurrectUrl(row.issueUrl.substr(1))*/
          type: 'flv',
          url: 'http://localhost:8000/live/hello.flv'
        })
        flvPlayer.attachMediaElement(videoElement)
        flvPlayer.load()
        flvPlayer.play()
      }

    }
  }
</script>

<style scpoed>
    .hello {
        margin-top: 100px;
    }
</style>
